package com.uls.questionnaire.service.impl;

import java.util.Date;
import java.util.List;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.uls.questionnaire.mapper.ResponseMapper;
import com.uls.questionnaire.domain.Response;
import com.uls.questionnaire.service.IResponseService;
import org.springframework.transaction.annotation.Transactional;


/**
 * 存储回答信息的Service业务层处理
 * 
 * @author zxh
 * @date 2024-11-17
 */
@Service
public class ResponseServiceImpl implements IResponseService 
{
    @Autowired
    private ResponseMapper responseMapper;

    /**
     * 查询存储回答信息的
     * 
     * @param responseId 存储回答信息的主键
     * @return 存储回答信息的
     */
    @Override
    public Response selectResponseByResponseId(Long responseId)
    {
        return responseMapper.selectResponseByResponseId(responseId);
    }

    /**
     * 查询存储回答信息的列表
     * 
     * @param response 存储回答信息的
     * @return 存储回答信息的
     */
    @Override
    public List<Response> selectResponseList(Response response)
    {
        return responseMapper.selectResponseList(response);
    }

    /**
     * 新增存储回答信息的
     * 
     * @param response 存储回答信息的
     * @return 结果
     */
    @Override
    public int insertResponse(Response response)
    {
        return responseMapper.insertResponse(response);
    }

    /**
     * 修改存储回答信息的
     * 
     * @param response 存储回答信息的
     * @return 结果
     */
    @Override
    public int updateResponse(Response response)
    {
        return responseMapper.updateResponse(response);
    }

    /**
     * 批量删除存储回答信息的
     * 
     * @param responseIds 需要删除的存储回答信息的主键
     * @return 结果
     */
    @Override
    public int deleteResponseByResponseIds(Long[] responseIds)
    {
        return responseMapper.deleteResponseByResponseIds(responseIds);
    }

    /**
     * 删除存储回答信息的信息
     * 
     * @param responseId 存储回答信息的主键
     * @return 结果
     */
    @Override
    public int deleteResponseByResponseId(Long responseId)
    {
        return responseMapper.deleteResponseByResponseId(responseId);
    }

    @Override
    public void saveResponse(Response response)
    {
        responseMapper.insertResponses(response);

    }

    @Override
    public void saveResponsesBatch(List<Response> responses) {
         if (responses != null && !responses.isEmpty()) {
        responseMapper.insertResponsesBatch(responses);
    }
    }


}
